home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C++ / Applications / Nuntius 1.2 / src / Nuntius / UDiscList.h < prev    next >
Encoding:
Text File  |  1994-03-06  |  2.2 KB  |  75 lines  |  [TEXT/MPS ]

  1. // Copyright © 1992 Peter Speck, speck@dat.ruc.dk. All rights reserved.
  2. // UDiscList.h
  3.  
  4. #define __UDISCLIST__
  5.  
  6. #ifndef __XTYPES__
  7. #include "XTypes.h"
  8. #endif
  9.  
  10. #ifndef __USTATDYNARRAY__
  11. #include "UStatDynArray.h"
  12. #endif
  13.  
  14. class CDiscussion;
  15. class THashTable;
  16.  
  17. class PDiscList : public PStatDynArray 
  18. {
  19.     public:        
  20.         void AddArticle(ArrayIndex discIndex, long id);
  21.         void AddArticleAsOriginator(ArrayIndex discIndex, long id, 
  22.                                         HandleOffsetLength msgIDHol, 
  23.                                         HandleOffsetLength nameHol);
  24.  
  25.         ArrayIndex CreateDiscussion(long id, 
  26.                                         HandleOffsetLength msgIDHol, 
  27.                                         HandleOffsetLength nameHol);
  28.  
  29.         CDiscussion *ComputeAddress(ArrayIndex discIndex);
  30.  
  31.         void GetName(ArrayIndex discIndex, CStr255 &name); // needs lock!
  32.         TLongintList *GetArticleIDList(ArrayIndex discIndex); // caller _owns_ returned list
  33.         long GetArticleID(ArrayIndex discIndex, long articleIndex);
  34.  
  35.         short GetNoArticles(ArrayIndex discIndex);
  36.         unsigned long GetLastActiveDateTime(ArrayIndex discIndex);
  37.  
  38.         void DeleteOldStuff(long firstAvailableArticleID, long lastAvailableArticleID);
  39.         void DeleteAll();
  40.         Boolean TryFindDiscussion(HandleOffsetLength idHol, ArrayIndex &discIndex);
  41.         
  42.         void DoRead(TStream *aStream);
  43.         void DoWrite(TStream *aStream);
  44.         long NeededDiskSpace();
  45.  
  46.         void DebugDump(Boolean verbose);        
  47.         Boolean SanityCheck();
  48.         
  49.         PDiscList();
  50.         void IDiscList();
  51.         ~PDiscList();
  52.     private:
  53.         THashTable *fHashTable;
  54.         long fKillDiscussionTime;
  55.  
  56.  
  57.         CDiscussion *FindDiscussionFromRef(char *&refP, long refLen, 
  58.                                                                             short hash, ArrayIndex &discIndex);
  59.         Boolean FindNextReference(char *&refP, long &refLen, short &hash);
  60.         void UnchainDiscussion(ArrayIndex index);
  61.         TLongintList *FindDiscussionsToDelete(long firstAvailableArticleID, long lastAvailableArticleID);
  62.  
  63.         void ExpandDiscussion(ArrayIndex discIndex, short spaceNeeded);
  64.         Boolean LockArray(Boolean lock);
  65.         
  66.         void DumpHashTableUsage();  // only for qDebug
  67.         Boolean SanityCheckLinks(); // only for qDebug
  68. };
  69.  
  70. inline CDiscussion *PDiscList::ComputeAddress(ArrayIndex discIndex)
  71. { return (CDiscussion*) PStatDynArray::ComputeAddress(discIndex); }
  72.  
  73. inline Boolean PDiscList::LockArray(Boolean lock)
  74. { return LockDataHandle(lock); }
  75.